package org.nfIt.controller;

import io.swagger.v3.oas.annotations.Operation;
import org.nfIt.entity.product.Category;
import org.nfIt.service.CategoryService;
import org.nfIt.vo.common.Result;
import org.nfIt.vo.common.ResultCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClossName:CategoryController
 * Pakage:org.nfIt.controller
 * Description
 *
 * @Author L
 * @Create 2024/7/19 22:09
 * @Version 2023.1.3
 */
@RestController
@RequestMapping(value="/admin/product/category")
public class CategoryController {


    @Autowired
    private CategoryService categoryService;

    /**
     * 根据parentId获取下级节点
     * @param parentId
     */
    @Operation(summary = "根据parentId获取下级节点")
    @GetMapping(value = "/findByParentId/{parentId}")
    public Result<List<Category>> findByParentId(@PathVariable Long parentId) {
        List<Category> list = categoryService.findByParentId(parentId);
        return Result.build(list , ResultCodeEnum.SUCCESS) ;
    }



}
